package com.itheima.myGenericity.genericitysummarize;

import java.util.ArrayList;
import java.util.Collections;

//传递一个集合,和四个元素,返回一个集合
public class Test1 {
    public static void main(String[] args) {
        ArrayList<Double> list1 = addElement(new ArrayList<Double>(), 1.0, 1.2, 1.3, 1.4);
        System.out.println(list1);

        ArrayList<String> list2 = addElement(new ArrayList<String>(),"a","b","c","d");
        System.out.println(list2);
    }

    public static <T> ArrayList<T> addElement(ArrayList<T> list, T t1, T t2, T t3, T t4) {
        Collections.addAll(list, t1, t2, t3, t4);
        return list;
    }
}


